package com.huyucheng.todolist

import androidx.room.*

@Dao
interface TodoDao {
    @Insert
    fun insertTodo(todo: Todo): Long

    @Update
    fun updateUser(newTodo: Todo)

    @Query("select * from Todo")
    fun loadAllTodos() : List<Todo>

    @Query("select * from Todo where priority > :priority")
    fun loadTodosPriorityHigherThan(priority: Int) : List<Todo>

//    @Query("select * from Todo where checked = :checked")
//    fun loadTodosByCheckedStatus(checked: Int)

    @Delete
    fun deleteTodo(todo: Todo)

    @Query("delete from Todo where checked = 0")
    fun deleteCheckedTodo(): Int
}